from django.db import models
from django.contrib.auth.models import User
from django.db.models import CASCADE, DO_NOTHING

class article(models.Model):
    title = models.CharField(max_length=200, unique=True)
    link = models.TextField()
    source = models.TextField()
    description = models.TextField()
    category = models.TextField()
    typeOf = models.TextField()
    pubDate = models.DateTimeField()
    image = models.TextField()
    contents = models.TextField()

    def __unicode__(self):
        return self.title

class comment(models.Model):
    content = models.TextField()
    postOnDate = models.DateTimeField(auto_now_add=True)
    userID = models.ForeignKey(User, related_name='commentUser')
    artID = models.ForeignKey(article, related_name="commentArticle")
    likeUser = models.ManyToManyField(User, blank=True, null=True, related_name='likeUser')

